package com.njuse.jvmfinal.Instruction;

import java.nio.ByteBuffer;

import com.njuse.jvmfinal.runtimestructure.Jarray;
import com.njuse.jvmfinal.runtimestructure.Jframe;

public class ARRAYLENGTH extends Instruction {
	
	public  void readindex(ByteBuffer reader) {
		//pass
	}
	
	public  void execute(Jframe frame) {
		int top=frame.getStacktop();
		Object[] stack=frame.getManagestack();
		Jarray ref=(Jarray) stack[top-1];
		top--;
		int length=ref.getLength();
		stack[top]=length;
		top++;
		frame.setManagestack(stack);
		frame.setStacktop(top);
	}
}
